package cn.xcyy.itcc.feginfallback;

import cn.xcyy.itcc.enums.GlodalErrorCode;
import cn.xcyy.itcc.fegin.CourseUserLearnFeignClient;
import cn.xcyy.itcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseUserLearnFeignClientFallbackFactory implements FallbackFactory<CourseUserLearnFeignClient> {
    @Override
    public CourseUserLearnFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new CourseUserLearnFeignClient() {
            @Override
            public JSONResult checkUrl(Long courseId, Long userId) {
                return JSONResult.error(GlodalErrorCode.SERVICE_ERROR);
            }
        };
    }
}
